home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / dino / dino_bot.1 / source / inc / D_lib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-03  |  10.0 KB  |  334 lines

  1. /* Copyright, 1990, Regents of the University of Colorado */
  2. /* 6/27 MATT, removed enum of D_first_env and D_last_env. replaced with ints*/
  3. /*  Variables and functions exported by the DINO Library.  */
  4.  
  5.     /* Macros */
  6.  
  7. #include "D_reduct.h"
  8. #define D_SIM 1
  9. #define D_CUBE 2
  10. #define D_SIM2 3
  11. #define D_CUBE2 4
  12. #define D_CUBE860 5
  13. #define D_BOOL char
  14. #define TRUE ((D_BOOL) 1)
  15. #define FALSE ((D_BOOL) 0)
  16. #if (D_MACH == D_CUBE)
  17. #define D_NULL ((char *) 0)
  18. #elif (D_MACH == D_CUBE2 || D_MACH == D_CUBE860)
  19. #if !i286 || SMALL_M || MIDDLE_M
  20. #ifndef NULL
  21. #define NULL            0
  22. #else
  23. #define NULL            0L
  24. #endif
  25. #endif
  26. #define D_NULL NULL
  27. #else
  28. #define D_NULL 0
  29. #endif
  30. #define D_HOST_NID ((short int) 0x8000)
  31. #define D_HOST_PID 1
  32. #if (D_MACH == D_SIM)
  33. #define D_MAX_MESS 0x4000
  34. #elif (D_MACH == D_SIM2 || D_MACH == D_CUBE) 
  35. #define D_MAX_MESS 0x4000
  36. #else
  37. #define D_MAX_MESS 0x8000
  38. #endif
  39. #define D_TYPE_BLOCK_START 30720
  40. #define D_TYPE_BLOCK_SIZE 2048
  41. #define D_PM_HD_SZ (2 * sizeof(long int))
  42. #define D_MP_HD_SZ (3 * sizeof(long int))
  43. #define D_LM_HD_SZ (2 * sizeof(long int))
  44. #define D_LME_CPC_HD_SZ (5 * sizeof(long int))
  45. #define D_LME_CPR_HD_SZ (3 * sizeof(long int))
  46. #define D_LME_DATA_HD_SZ (3 * sizeof(long int))
  47. #define D_CPC_MTYPE 0
  48. #define D_MAX_STRUCTURES 10
  49. #define D_MAX_ENVS 128
  50. #define D_min(x,y) (x<y?x:y)
  51. #define D_max(x,y) (x>y?x:y)
  52.  
  53. #if (D_MACH == D_CUBE)
  54. #define D_init_bitmap d_init_bitmap
  55. #define D_mem_copy d_mem_copy
  56. #endif
  57.  
  58. #if (D_MACH == D_CUBE2)
  59. #define D_mem_copy memcpy
  60. #endif
  61.  
  62. /* Macros for the new composite procedure stuff */
  63.  
  64. /* The following object allows referencing D_mess_tmp in long ints */
  65. #define D_mess_lint  ((long int *) &D_mess_tmp [0])
  66.  
  67.  
  68.     /* Types */
  69.  
  70. typedef struct {
  71.                 int count;
  72.                 int name;
  73.                 D_BOOL allflag;
  74.                 D_BOOL implicit;
  75.                 D_BOOL *bitmap;
  76.                } D_env_set;
  77.  
  78. typedef struct {
  79.                 long int first;
  80.                 long int last;
  81.                 long int size;
  82.                } D_range_desc;
  83.  
  84. typedef struct {
  85.                 long int first;
  86.                 long int last;
  87.                } D_sh_range_desc;
  88.  
  89. typedef struct {
  90.                 char *loc;
  91.                 long int size;
  92.                } D_storage_space_desc;
  93.  
  94. typedef struct {
  95.                 D_BOOL needed;
  96.                 int elem_size;
  97.                 int dims;
  98.                 D_range_desc *range;
  99.                } D_data_distribution_desc;
  100.  
  101. typedef struct {
  102.                 int (* type)();
  103.                 D_BOOL simple;
  104.                 int dims;
  105.                 D_sh_range_desc *range;
  106.                } D_data_name_desc;
  107.  
  108. typedef struct {
  109.                 long int l_over;
  110.                 long int l_main;
  111.                 long int r_main;
  112.                 long int r_over;
  113.                 int env;
  114.                } D_entry;
  115.    
  116. typedef struct {
  117.                 long int size;
  118.                 long int data_size;
  119.                 long int env_size;
  120.                 long int node_size;
  121.                 int align;
  122.                 int pieces;
  123.                 long int wrap;
  124.                 long int offset;
  125.                 D_BOOL wrapflag;
  126.                 D_BOOL compress;
  127.                 D_BOOL allflag;
  128.                 D_entry *list;
  129.                } D_env_map;
  130.                
  131. typedef struct {
  132.                 int name;
  133.                 int dims;
  134.                 int env_dims;
  135.                 int elem_size;
  136.                 D_BOOL allflag;
  137.                 D_BOOL *cross;
  138.                 D_env_map *envm;
  139.                 D_BOOL converted;
  140.                } D_data_mapping_desc;
  141.  
  142. typedef enum {gmax, gmin, gsum, gprod, gmaxdex, gmindex
  143.              } D_reduct;
  144.  
  145. typedef struct {
  146.                 char *name;     /*name of file to load*/
  147.                 D_BOOL is_host; /*if it is host*/
  148.                 D_BOOL on_host; /*if it is to be loaded on host*/
  149.                 int n_dims;     /*number of dims in structure*/
  150.                 int *dim;       /*the size of each dim*/
  151.                 int size;       /*total number of environments*/
  152.                 D_BOOL is_big;  /*if size > number of processors*/
  153.                 int start;      /*where to start placing envs if !is_big*/
  154.                 int pid;        /*first pid to use for this structure*/
  155.                 int *pids;      /*number of processes/processor for each dim*/
  156.                 int *mach_dim;  /*lg of size of each dim for the target mach:
  157.  
  158.                             * eg: a 4x8 env is mapped onto a machine which is
  159.                             *          4x4 which results in lg(4)xlg(4) = 2x2
  160.                             *      2x16 mapped to 1x16 so 0x4
  161.                             *      4x16 mapped to 2x8 so 1x3
  162.                             *  NB. sum of mach_dims = dimension of cube */
  163.                } D_env_tbl;
  164.  
  165. typedef struct {
  166.                 D_storage_space_desc *store;
  167.                 D_data_mapping_desc *map;
  168.                 D_data_distribution_desc *dist;
  169.                } D_parm;
  170.  
  171. typedef struct {
  172.                 int numb;
  173.                 D_parm *parm;
  174.                } D_parm_list;
  175.  
  176. typedef struct {
  177.                 int name;
  178.                 int index;
  179.                } envvar;
  180.  
  181. typedef struct {
  182.                 int node;
  183.                 int pid;
  184.                } D_process;
  185.  
  186. typedef struct {
  187.                 int type;
  188.                } D_type_desc;
  189.  
  190. typedef enum {D_route_pair, D_route_rcvsnd, D_route_recv} D_route_type;
  191.  
  192. typedef struct {
  193.                 long int size;
  194.                 long int current;
  195.                 long int incr;
  196.                 long int chunks;
  197.                 long int wcurrent;
  198.                 long int jump;
  199.                 long int loff;
  200.                 long int adj;
  201.                } D_copy_list_2;
  202.             
  203. typedef struct {
  204.                 int dims;
  205.                 long int start;
  206.                 long int current;
  207.                 long int stop;
  208.                 int level;
  209.                 D_copy_list_2 *part;
  210.                } D_copy_list;
  211.  
  212. typedef struct {
  213.                 int index;
  214.                 D_BOOL main;
  215.                 D_BOOL over;
  216.                 long int stop;
  217.                 long int start;
  218.                 long int r_main;
  219.                 long int l_main;
  220.                 int piece;
  221.                 long int size;
  222.                } D_analysis;
  223.  
  224. typedef struct {
  225.                 int type;
  226.                 int dims;
  227.                 D_sh_range_desc *range;
  228.                }  D_int_dnd;
  229.  
  230.  
  231. typedef struct {
  232.                 int total;              /* Number of active
  233.                                                     environments in array. */
  234.                 int name;               /* Name of this
  235.                                                     environment structure. */
  236.                 int index;              /* Index of this environment. */
  237.                 D_BOOL implicit;        /* Environment was determined by dmd. */
  238.                 D_BOOL *contig;         /* Data is physically contiguous. */
  239.                 D_BOOL done;            /* Message for this environment was
  240.                                                 received (or if async,
  241.                                                 environment was checked). */
  242.                 int header;             /* Size of the header for this message. */
  243.                 int type;               /* Message type for receipt
  244.                                                         of subsequent parts.*/
  245.                 char **loc;             /* Pointer to contiguous data start. */
  246.                 char *mess;             /* Pointer to received message. */
  247.                 D_int_dnd *desc;        /* Pointer to dnd
  248.                                                         for this environment. */
  249.                 long int *size;         /* Size of data in message. */
  250.                 int node;               /* Node number for this environment. */
  251.                 int pid;                /* Pid number for this environment. */
  252.                 int parts;              /* Number of parts for this message. */
  253.                 long int offset;        /* Current offset in message
  254.                                                (used for contiguous copies). */
  255.                 D_copy_list **clist;    /* Copy list for this environment. */
  256.                } D_np;
  257.  
  258. typedef struct {
  259.                 D_np *e;
  260.                 D_data_name_desc *n;
  261.                 D_analysis *a;
  262.                } D_data_holder;
  263.  
  264.     /* Functions */
  265.  
  266. #define D_quick_send_olap(dS,dE,dD,dM,dN,dC,oL,oR,oA,oD,P) \
  267.     D_quick_olap(1,dS,dE,dD,dM,dN,TRUE,dC,oL,oR,oA,oD,P)
  268.  
  269. #define D_quick_recv_olap(dS,dE,dD,dM,dN,dY,dC,oL,oR,oA,oD,P) \
  270.     D_quick_olap(0,dS,dE,dD,dM,dN,dY,dC,oL,oR,oA,oD,P)
  271.  
  272. extern void D_lib_send();
  273. extern void D_lib_recvs();
  274. extern void D_isend_init();
  275. extern void D_lib_isend();
  276. extern void D_lib_irecv();
  277.  
  278. extern void D_env_init();
  279. extern envvar D_from();
  280. extern D_recv_no_storage();
  281.  
  282. /* This is the new composite procedure stuff */
  283. extern int D_lib_cpc_a_init();
  284. extern D_BOOL D_lib_cpc_a_next();
  285. extern void D_lib_cpr_a_init();
  286. extern D_BOOL D_lib_cpr_a_next();
  287.  
  288. extern int D_lib_cpc_f_init();
  289. extern void D_lib_cpr_f_init();
  290.  
  291. extern long int D_block_func_l();
  292. extern long int D_block_func_r();
  293.  
  294. extern void D_lib_flush_buf();
  295. extern void D_lib_refresh_buf();
  296. extern void D_lib_align();
  297.  
  298. /* END (new stuff) */
  299.  
  300. extern void D_comp_driver();
  301. extern void D_init_bitmap();
  302.  
  303.  
  304.     /* Data */
  305.  
  306. extern void (*D_comps[])();
  307. extern envvar caller;
  308. extern D_env_tbl D_env_table[];
  309. extern int *(D_local_env_table[]);
  310. /*extern enum D_env_names D_first_env, D_last_env;*/
  311. extern int D_first_env, D_last_env;
  312. extern D_BOOL D_route_stack[]; /*1<<upper(lg(size)) ie 2^n and >= size*/
  313. extern short int D_route_children[]; /*1<<upper(lg(size)) ie 2^n and >= size*/
  314. extern D_BOOL D_route_tree_map[]; /*size of my_env*/
  315. #if D_MACH==D_CUBE2 || D_MACH==D_SIM2 || D_CUBE860
  316. extern long D_gsend[];
  317. #endif
  318.  
  319. /* Here's the stuff for the new composite procedures */
  320. extern char *D_buf;
  321. extern double D_mess_tmp [];
  322. extern long int D_rem;
  323. extern int D_le;
  324. extern int D_main_type;
  325. extern int D_sub_type;
  326. extern D_env_set *D_es;
  327. extern int D_cp;
  328. extern int D_env_size;
  329. extern int D_n_envs;
  330. extern D_BOOL D_first_msg;
  331. extern int D_node;
  332. extern int D_pid;
  333. extern long int D_size;
  334.